package com.phkj.qdh.repository

import com.phkj.qdh.bean.InstructionBean
import com.phkj.qdh.bean.InstructionDetailBean
import com.phkj.qdh.bean.JingQingDetailBean
import com.phkj.qdh.bean.JingQingResult
import com.phkj.qdh.net.APP_LOGIN
import com.phkj.qdh.net.HOME_NOTIFICATION_LIST
import com.phkj.qdh.net.INSTRUCTION_DETAIL
import com.phkj.qdh.net.INSTRUCTION_FEED_BACK
import com.phkj.qdh.net.INSTRUCTION_LIST
import com.phkj.qdh.net.INSTRUCTION_REJECT
import com.phkj.qdh.net.JINGQING
import com.phkj.qdh.net.PageList
import rxhttp3.RxHttp
import rxhttp3.toFlowResponse
import java.util.HashMap

object InstructionRepository {
    fun getInstructionList(map : HashMap<String, Any?>)=
        RxHttp.get(INSTRUCTION_LIST).addAll(map).toFlowResponse<PageList<InstructionBean>>()


    fun getInstructionDetail(map : HashMap<String, Any?>)=
        RxHttp.get(INSTRUCTION_DETAIL).addAll(map).toFlowResponse<InstructionDetailBean>()


    fun getInstructionFeedback(map : HashMap<String, Any?>)=
        RxHttp.postJson(INSTRUCTION_FEED_BACK).addAll(map).toFlowResponse<Boolean>()

    fun getInstructionReject(id:Int)=
        RxHttp.get(INSTRUCTION_REJECT).add("instructionId",id).toFlowResponse<Boolean>()

    fun getJingQingDeatil(id:String) =
        RxHttp.postJson(JINGQING).add("receiveId",id).toFlowResponse<JingQingResult>()
}


